﻿using System.Security.Principal;
using System.Web;
using System.Web.Security;
using MiniWeb.Task;

namespace MiniWeb.Web.Controllers.Admin
{
    public static class AdminFormsAuthService
    {

       

        public static void SignIn(string userName, bool createPersistentCookie)
        {
            
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }

        public static void SignOut()
        {
            FormsAuthentication.SignOut();
        }

        public static bool IsSignedIn()
        {
            string username = HttpContext.Current.User.Identity.Name;
            
            
            return HttpContext.Current.User.Identity.IsAuthenticated;
        }

        public static IIdentity GetCurrentIdentity()
        {
            string username = HttpContext.Current.User.Identity.Name;
           
            return HttpContext.Current.User.Identity;
        } 

       public static string GetCurrentUser()
       {
          

          return  HttpContext.Current.User.Identity.Name;
       }
    }
}